/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package teamgandalf;

import java.io.*;
import java.util.*;

/**
 *
 * @author Bryce
 */
public class ProductCatalog {
    private Map<Integer, ProductSpec> catalog;
    private ProductReader productReader;
    
    ProductCatalog() {
        catalog = new HashMap<Integer, ProductSpec>();
        try {
            productReader = new ProductReader("products.txt");
        } catch (IOException e) {
            System.out.println(e);
        }
        
        while (productReader.hasMoreProducts()) {
            ProductSpec product = productReader.getNextProduct();
            System.out.println(product.getUPC() + " " + product.getDescription() + " " + product.getPrice());
            catalog.put(product.getUPC(), product);
        }
    }
    
    // for testing purposes
    public static void main(String[] args) throws IOException {
        ProductCatalog test = new ProductCatalog();
    }
}
